Skip to content

feat(selectors): assert checked state with is checked and checked= - #4736

Merged
thymikee merged 1 commit into
mainfrom
t3/assert-checked-state
Nov 19, 2026
Merged

thymikee merged 1 commit into
mainfrom
t3/assert-checked-state

Conversation

@thymikee

@thymikee thymikee commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

Summary

Snapshot nodes already publish checked on Android (ui-hierarchy.ts) and iOS (ios-node-interpretation.ts, which can also produce 'mixed'), and snapshot/get attrs show it, but the selector language could not assert it. This adds checked as a selector boolean key and an is checked predicate, so flows can assert the state of switches, checkboxes, and radios:

agent-device is checked 'role=switch label="Wi-Fi"'
agent-device wait 'id="tos" checked=true' 5000

checked= is three-valued: checked=true matches only node.checked === true and checked=false only node.checked === false; iOS 'mixed' and an absent fact (a non-checkable Android node) match neither, because checked is published only on checkable controls and absent means "not checkable", not "unchecked". is checked passes only on an explicitly checked node and includes checked in its details JSON. 14 files changed: contracts IS_PREDICATES, selectors parse/match/predicates, command-surface metadata, CLI help (via IS_PREDICATES/SELECTOR_KEY_NAMES), fuzz/property arbitries, parity tests, focused unit tests (true/false/mixed/undefined), and website docs. The docs also note that Android id= matches the full pkg:id/name resource-id, React Native testIDs arrive bare, and a Jetpack Compose Modifier.testTag reaches agent-device only with semantics { testTagsAsResourceId = true }.

Validation

  • Head: e6eb985d1d (branch t3/assert-checked-state, rebased on origin/main).
  • pnpm install --frozen-lockfile && pnpm build — pass.
  • pnpm format then local gate set mirroring pnpm check:affected --run (fail-open plan): format:check, lint, typecheck, layering, di-seams, fallow, native-dupes, mcp-metadata, production-exports, bundle-owner-files, gate-manifest(+test), check:affected:test, depgraph:test, tmpdir-leaks(+test), coverage/wire-compat/mutation model tests, replay-compat, daemon-wire-compat, check:package, test:integration:node, test:integration:macos-coverage, test:integration:provider (306 pass), test:integration:progress:check, test:fixture-cache, test:fixture-fallback, maestro:conformance, check:xctest-selection, check:packaged-runner-swift, docs checks (command-docs, doc-links, doc-prose, agent-guidance, adr-citations, capabilities-matrix) — all pass.
  • Focused unit tests: packages/selectors match/parse/predicates (incl. mixed and undefined-checked negatives), packages/contracts, daemon is-predicates/selector-runtime-is, command-runtime selector-is, src/__tests__/is-argument-surface-parity.test.ts, cli-grammar.test.ts — all pass; vitest related over the 14 changed files: 410 pass; apple-runner+fuzz-worker projects: 993 pass; smoke: pass. A full unit-core sweep showed 12 failures in 6 unrelated files (release-publish, fuzz harness, auth-session lane, repo-guards) that pass both with and without this diff in isolation — load flakiness of this sandbox, not this change.
  • CI obligations: device/emulator and coverage lanes remain GitHub-authoritative; no device-facing behavior changed (selector matching only).

🤖 Generated with Claude Code


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

View guided diff Turn on auto-fix

Adds “checked” to the selector boolean keys and the is predicate
vocabulary so flows can assert the checked state of switches,
checkboxes, and radios that snapshot nodes already publish.

checked= is three-valued: checked=true matches only node.checked ===
true, checked=false only node.checked === false; iOS “mixed” and an
absent fact (a non-checkable Android node) match neither. is checked
passes only on an explicitly checked node and reports checked in its
details JSON. Usage hint, positional rotation, command metadata, CLI
help (via IS_PREDICATES / SELECTOR_KEY_NAMES), fuzz and property
arbitraries, and the website selector docs are updated, including a
note that Android id= matches the full pkg:id/name resource-id,
React Native testIDs arrive bare, and Compose testTags need
testTagsAsResourceId = true.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
@github-actions

Copy link
Copy Markdown
Contributor

Size Report

Metric Base Current Diff
Installed (including dependencies) 6.40 MB 6.39 MB -7.8 kB
Package (unpacked) 6.40 MB 6.39 MB -7.8 kB
Package (download) 1.94 MB 1.94 MB -3.6 kB

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 27.6 ms 22.8 ms -4.8 ms
CLI --help 62.5 ms 49.8 ms -12.8 ms

@apex-sentinel-staging

Copy link
Copy Markdown

Apex Sentinel · ✅ Approve · review of e6eb985

No open findings.

1 finding below minor hidden (user_settings.min_severity).

Reviewed with this repository's own Sentinel configuration (6e1dc283fb56).

💬 Talking to Sentinel

In a finding's thread, reply with:

Command What it does
@apex-sentinel-staging note <context> Adds context; Sentinel re-checks the cited code
@apex-sentinel-staging pivot <why> Says the finding is wrong; Sentinel re-checks the cited code
@apex-sentinel-staging like Marks the finding as useful
@apex-sentinel-staging dislike <why> Marks it as not useful, so it is not raised again

On this conversation, comment @apex-sentinel-staging review to run a full review once again.

@thymikee

Copy link
Copy Markdown
Member Author

This is ready to merge at e6eb985. The change is correct and well owned: the route from the CLI through checkIsPredicate, selector-is and evaluateIsPredicate/matchesTerm has no problem. The 19 checks are green and none fail. There are no conflicts. The snapshot producers already publish checked, so this selector-only change needs no device run. Nothing else must happen before merge.

Not blocking, and you can take or leave these: (1) the mixed fixtures in match.test.ts:244 and predicates.test.ts:370, and the comments in match.ts:44-47 and predicates.ts:78, model an iOS node with checked: 'mixed' cast through as unknown as boolean, but a mixed control reaches the matcher with checked undefined and only iosValueSemantics.checked set, so please use that shape or drop the nodes and reword the comments; (2) the new id= paragraph in selectors.md, with its React Native testID and Jetpack Compose testTagsAsResourceId claims, is unrelated to checked state and needs evidence for those framework claims, so it may fit better in its own docs PR with evidence; (3) the rewrapped comment at predicates.ts:48 is now one word longer than the lines after it, and bare checked now parses as a selector like selected and visible, which may be worth a mention in the docs' bare-boolean note.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 19, 2026
@thymikee
thymikee merged commit 97f1638 into main Nov 19, 2026
19 checks passed
@thymikee
thymikee deleted the t3/assert-checked-state branch November 19, 2026 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant